<?php
    $this->headTitle($this->site_name.' - Link Account');
?>
<script type="text/javascript" src="/js/jquery.validate.js"></script>
<script type="text/javascript">   
	$(document).ready(function(){
	    $("#form").validate({
	      rules: {
        	email: {
	          required: true,
	          email: true
		    },
        	password: {
			      required: true
			}
	      },
	      messages: {
		  	email: {
	          required: "Email can not be empty",
	          email: "Email must be valid"
	        },
	        password: {
	          required: "Password can not be empty"
	        }
	      }
	    });
	});
</script>  
<?php if (!empty($this->success_msg)):?>
<div class="response-msg success ui-corner-all"><?php echo $this->success_msg;?></div>
<?php endif ?>

<?php if (!empty($this->error_msg)):?>
<div class="response-msg error ui-corner-all"><?php echo $this->error_msg;?></div>
<?php endif ?>

<div id="dashboard">

<h2>Link Account</h2>
 


<div align=center style="font-size:13px;margin:20px 0;">
<div style="text-align:left;">Link your YesUp Accounts.</div>


<div style="width:400px;margin:40px 20px;">

        <div style="text-align:left">
        
			<h3>Linked Accounts: <br>
				<?php 
					echo $this->user_name."<br>"; 
					foreach($this->link_accounts[ $this->client_id ] as $key => $value){
						if ($key!=$this->user_id){
					  		echo $value.'<a href="#" onclick=\'if ( confirm("Are you sure to remove this linked account?")) location="/client/settings/link-account/id/'.$key.'/act/remove";\' style="display:inline;font-size:12px;margin-left:10px;"><u>Remove</u></a><br>'; 
						}
					}
				?>
			</h3>

			<h3>Link more account:</h3>
<div style="text-align:left;float:left;"><a href="#" class="grey-btn" onclick="if ( $('#yesup_account').css('display')=='none' ) $('#yesup_account').show(); else $('#yesup_account').hide(); "><b class="ui-title">YesUp Account</b></a></div>
<div style="text-align:left;float:left;margin-left:20px;"><a href="/client/settings/google" class="grey-btn"><b class="ui-title">Google Account</b></a></div>
<div class="clearfix" style="height:20px;"></div>

			<div id="yesup_account" style="display:none;">
            <form id="form" name="form" method="post">
            	<input type="hidden" name="client_id" id="client_id" value="<?php echo  $this->client_id; ?>">
				<dl class="form">
				<dt id="email-label"><label for="email" class="optional">YesUp Account Email:</label></dt>
				<dd id="email-element">
				<input type="text" name="email" id="email" value="" size="32" /></dd>
				<dt id="password-label"><label for="password" class="optional">Password</label></dt>
				<dd id="password-element">
				<input type="password" name="password" id="password" value="" size="32" />
				</dd>
				<dt id="submit-label">&#160;</dt>
				<dd id="submit-element">
				<input type="submit" name="submit" id="submit" value="Submit" />
				</dd>
				</dl>

            
            </form>
            </div>

        </div>
</div>


</div>

</div>
